/*package net.jsoft.pms.web.oracle.problems;

import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import net.jsoft.platform.core.util.platform.PlatformUtils;
import net.jsoft.platform.core.web.BaseController;
import net.jsoft.pms.service.oracle.problems.IProblemsService;
import net.jsoft.pms.vo.problems.ProblemTaskBean;

*//**
  * 问题管理平台控制器
  *
  * @author John
  * @Date 2017-08-03 10:55:31
  */
/*
@Controller
@RequestMapping("/problems")
public class ProblemsController extends BaseController
{

 private String PREFIX = "/pms/oracle/problems/";
 //    private String oldfilepath = "C:\\Users\\JOHN_ZHAO\\Desktop\\事件列表.xlsx";
 //    private String newfilepath = "C:\\Users\\JOHN_ZHAO\\Desktop\\事件列表1.xlsx";

 private String loadType = "DB";

 @Resource(name = "problemsServiceImpl")
 IProblemsService service;

 *//**
   * 跳转到问题管理平台首页
   */
/*
@RequestMapping("")
public String index()
{
 return PREFIX + "problems.html";
}

*//**
  * 跳转到问题管理平台首页
  */
/*
@RequestMapping("/problemsPage")
public String problemsPage()
{
 return PREFIX + "problemsPage";
}

*//**
  * 
  * @return
  *//*
    @RequestMapping("/overall")
    @ResponseBody
    public Map<String, Object> overall()
    {
     Map<String, Object> resp = new HashMap<String, Object>();
     List<ProblemTaskBean> lastWeek = null;
     List<ProblemTaskBean> thisWeek = null;
    
     if ("DB".equals(loadType))
     {
         //读取数据库模式
         Map<String, List<ProblemTaskBean>> tempMap = service.getProblems();
         lastWeek = tempMap.get("lastWeek");
         thisWeek = tempMap.get("thisWeek");
     }
     else
     { //读取文件模式
           //            lastWeek = service.read(oldfilepath, 0);
       //            thisWeek = service.read(newfilepath, 0);
     }
    
     List<ProblemTaskBean> dealed = service.dealed(lastWeek, thisWeek);
     List<ProblemTaskBean> thisWeekNew = service.thisWeekNew(lastWeek, thisWeek);
     Map<String, List<ProblemTaskBean>> group = service.group(thisWeek);
     resp.put("dealed", dealed);
     resp.put("thisWeekNew", thisWeekNew);
     resp.put("lastWeek", lastWeek);
     resp.put("thisWeek", thisWeek);
     resp.put("group", group);
     return resp;
    }
    
    // 导出excel方法
    @SuppressWarnings(
    { "resource" })
    @RequestMapping("/exportExcel")
    public void exportExcel(HttpServletRequest request, HttpServletResponse response)
    {
     HttpSession session = request.getSession();
     session.setAttribute("state", null);
     // 生成提示信息，
     response.setContentType("application/vnd.ms-excel");
     String codedFileName = null;
     OutputStream fOut = null;
     //        List<ProblemTaskBean> thisWeek = service.read(newfilepath, 0);
     Map<String, List<ProblemTaskBean>> tempMap = service.getProblems();
     //        lastWeek = tempMap.get("lastWeek");
     List<ProblemTaskBean> thisWeek = tempMap.get("thisWeek");
     try
     {
         // 进行转码，使其支持中文文件名
         codedFileName = URLEncoder.encode("问题管理平台问题", "UTF-8");
         response.setHeader("content-disposition", "attachment;filename=" + codedFileName + ".xls");
         // 产生工作簿对象
         HSSFWorkbook workbook = new HSSFWorkbook();
         // 产生工作表对象
         HSSFSheet sheet = workbook.createSheet();
         int i = 1;
    
         HSSFCellStyle cellStyle = workbook.createCellStyle();
         cellStyle.setWrapText(false);
    
         HSSFRow row = sheet.createRow(0);// 创建一行
         row.setRowStyle(cellStyle);
    
         row.createCell(0, CellType.STRING).setCellValue("问题编号");
         row.createCell(1, CellType.STRING).setCellValue("组别");
         row.createCell(2, CellType.STRING).setCellValue("处理人员");
         row.createCell(3, CellType.STRING).setCellValue("标题");
         row.createCell(4, CellType.STRING).setCellValue("内容");
    
         for (ProblemTaskBean p : thisWeek)
         {
             row = sheet.createRow(i);// 创建一行
             row.setRowStyle(cellStyle);
             row.createCell(0, CellType.STRING).setCellValue(p.getId());
             row.createCell(1, CellType.STRING).setCellValue(p.getGroupName());
             row.createCell(2, CellType.STRING).setCellValue(p.getOptPerson());
             row.createCell(3, CellType.STRING).setCellValue(p.getTitle());
             row.createCell(4, CellType.STRING).setCellValue(p.getContent());
             i++;
         }
         fOut = response.getOutputStream();
         workbook.write(fOut);
     }
     catch (UnsupportedEncodingException e1)
     {
     }
     catch (Exception e)
     {
     }
     finally
     {
         try
         {
             if (fOut != null)
             {
                 fOut.flush();
                 fOut.close();
             }
         }
         catch (IOException e)
         {
         }
         session.setAttribute("state", "open");
     }
    }
    
    @RequestMapping(value = "/uploadFile")
    public void importFile(HttpServletRequest req, @RequestParam(value = "problemFile") MultipartFile file) throws Exception
    {
     //判断文件是否为空
     if (file == null)
     {
         throw new Exception("文件为空");
     }
    
     //获取文件名
     String fileName = file.getOriginalFilename();
    
     //验证文件名是否合格
     if (!PlatformUtils.validateExcel(fileName))
     {
         throw new Exception("文件必须是excel格式！");
     }
    
     //进一步判断文件内容是否为空（即判断其大小是否为0或其名称是否为null）
     long size = file.getSize();
     if (StringUtils.isEmpty(fileName) || size == 0)
     {
         throw new Exception("文件不能为空！");
     }
    
     //批量导入
     service.batchImport(file.getInputStream());
    
    }
    }
    */